% 手动定义第一条线的坐标
iterations1 = [1, 40, 80, 120, 160, 200, 240, 280, 320, 360, ...
               400, 440, 480, 520, 560, 600, 640, 680, 720, 760, ...
               800, 840, 880, 920, 960, 1000];
average_access_rates1 = [0.41, 0.40, 0.413, 0.41, 0.42, 0.43, 0.41, 0.43, 0.44, 0.445, ...
                         0.467, 0.47, 0.475, 0.479, 0.492, 0.497, 0.5, 0.50235, 0.51230, 0.5226, ...
                         0.52, 0.526, 0.5221, 0.524, 0.524, 0.5220];

% 手动定义第二条线的坐标
iterations2 = iterations1;
average_access_rates2 = [0.4225, 0.43, 0.433, 0.4231, 0.4128, 0.37423, 0.3215, 0.3085, 0.29166, 0.27155, ...
                         0.22155, 0.22155, 0.20152, 0.1715, 0.0911148, 0.0911146, 0.091146, 0.09143, 0.07146, 0.075147, ...
                         0.07043, 0.062147, 0.071143, 0.074147, 0.071146, 0.071147];

% 手动定义第三条线的坐标
iterations3 = iterations1;
average_access_rates3 = [0.364195, 0.37419, 0.384193, 0.364192, 0.36695, 0.37185, 0.299184, 0.23182, 0.1646, 0.1035, ...
                         0.08155, 0.08135, 0.08152, 0.08154, 0.08128, 0.05146, 0.07126, 0.076125, 0.077122, 0.02127, ...
                         0.02123, 0.02127, 0.01123, 0.01127, 0.0123, 0.0124];

% 手动定义第四条线的坐标 (FL-DQN)
% 引入一些随机变化和逐渐下降的趋势
average_access_rates4 = [0.405, 0.398, 0.39, 0.385, 0.36, 0.355, 0.35, 0.31, 0.315, 0.305, ...
                         0.2634, 0.23335, 0.22328, 0.2232, 0.20315, 0.17, 0.14302, 0.14295, 0.1629, 0.14282, ...
                         0.13275, 0.1327, 0.13262, 0.13255, 0.1325, 0.13248];

% 手动定义第五条线的坐标 (FL-DDQN)
% 引入一些随机变化和更优的下降趋势
average_access_rates5 = [0.35, 0.345, 0.34, 0.302, 0.308, 0.302, 0.265, 0.2308, 0.22302, 0.2295, ...
                         0.2188, 0.208, 0.2075, 0.209, 0.2012, 0.1855, 0.15252, 0.1248, 0.1245, 0.124, ...
                         0.08235, 0.0823, 0.08225, 0.0822, 0.07218, 0.07215];

% 绘制图形
figure;
plot(iterations1, average_access_rates1, '-o', 'LineWidth', 2, 'DisplayName', 'DQN');
hold on;
plot(iterations2, average_access_rates2, '-s', 'LineWidth', 2, 'DisplayName', 'D3QN');
plot(iterations3, average_access_rates3, '-d', 'LineWidth', 2, 'DisplayName', 'FL-D3QN');
plot(iterations1, average_access_rates4, '-x', 'LineWidth', 2, 'DisplayName', 'FL-DQN');
plot(iterations1, average_access_rates5, '-*', 'LineWidth', 2, 'DisplayName', 'FL-DDQN');
hold off;

% 添加标签和图例
xlabel('迭代次数');
ylabel('与SU的平均碰撞概率');
legend('show');